package org.cypress.rtpack.common.utils;

import org.springframework.core.env.Environment;

/**
 * @author vv
 * @since 2020/3/31
 */
public class ConfigUtil {

	/**
	 * 从bootstrap.yml中获取配置
	 * 
	 * @param key
	 * @param defaultValue
	 * @return
	 */
	public static String getProperty(String key, String defaultValue) {
		Environment env = SpringUtil.getBean(Environment.class);
		return env.getProperty(key, defaultValue);
	}

	public static <T> T getProperty(String key, Class<T> targetType) {
		Environment env = SpringUtil.getBean(Environment.class);
		return env.getProperty(key, targetType);
	}
}
